/* Camera.cpp  -- camera representation

Copyright (C) 2010 Gabriel Alises Cano, Javier Angulo Lucerón

This file is part of Computer Graphics : Final Project 09-10.

Computer Graphics : Final Project 09-10 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Computer Graphics : Final Project 09-10 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Computer Graphics : Final Project 09-10.  If not, see <http://www.gnu.org/licenses/>. */


#include "Camera.h"

Camera :: Camera (GLdouble *position, GLdouble *look, GLdouble *up)
{
	copy(position,position+3,_pos);
	copy(look,look+3, _look);
	copy(up,up+3,_up);
}

GLdouble * 
Camera::pos ()
{
	return _pos;
}

GLdouble 
Camera::pos_x () const 
{
	return _pos[0];
}

GLdouble 
Camera::pos_y () const 
{
	return _pos[1];
}

GLdouble 
Camera::pos_z () const 
{
	return _pos[2];
}

GLdouble * 
Camera::look ()
{
	return _look;
}

GLdouble 
Camera::look_x () const 
{
	return _look[0];
}

GLdouble 
Camera::look_y () const 
{
	return _look[1];
}

GLdouble 
Camera::look_z () const 
{
	return _look[2];
}

GLdouble * 
Camera::up ()
{
	return _up;
}

GLdouble 
Camera::up_x () const 
{
	return _up[0];
}

GLdouble 
Camera::up_y () const 
{
	return _up[1];
}

GLdouble 
Camera::up_z () const 
{
	return _up[2];
}

void
Camera::place ()
{
	gluLookAt(_pos[0],_pos[1],_pos[2],_look[0],_look[1],_look[2],_up[0],_up[1],_up[2]);
}

void
Camera::set_pos(GLdouble x, GLdouble y, GLdouble z)
{
	_pos[0]=x;
	_pos[1]=y;
	_pos[2]=z;
}

void
Camera::set_pos_x(GLdouble x)
{
	_pos[0]=x;
}

void
Camera::set_pos_y(GLdouble y)
{
	_pos[1]=y;
}

void
Camera::set_pos_z(GLdouble z)
{
	_pos[2]=z;
}

void
Camera::set_up(GLdouble x, GLdouble y, GLdouble z)
{
	_up[0]=x;
	_up[1]=y;
	_up[2]=z;
}

void
Camera::set_up_x(GLdouble x)
{
	_up[0]=x;
}

void
Camera::set_up_y(GLdouble y)
{
	_up[1]=y;
}

void
Camera::set_up_z(GLdouble z)
{
	_up[2]=z;
}

void
Camera::set_look(GLdouble x, GLdouble y, GLdouble z)
{
	_look[0]=x;
	_look[1]=y;
	_look[2]=z;
}

void
Camera::set_look_x(GLdouble x)
{
	_look[0]=x;
}

void
Camera::set_look_y(GLdouble y)
{
	_look[1]=y;
}

void
Camera::set_look_z(GLdouble z)
{
	_look[2]=z;
}
